<%--
  Created by IntelliJ IDEA.
  User: LP
  Date: 2016/12/30
  Time: 15:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>test</title>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
</head>
<body>
<button type="button" onclick="save()">save</button>
<button type="button" onclick="list()">list</button>
<button type="button" onclick="update()">update</button>

<div id="msg"></div>

<a href="<%=request.getContextPath()%>/role.jsp">角色管理</a>



</body>
</html>
<script>
    $(function () {
        document.title = "test"+new Date().getTime();
    });
    function save() {
        $.post({
            url: "<%=request.getContextPath()%>/rs/Role/save",
            data: JSON.stringify({
                roleName: "admin",
                roleType:"admin",
                resources:[{id:279}]
            }),
            success: function( result ) {
                $("#msg").html( JSON.stringify(result));
            }
        });
    }

    function list() {
        $.post({
            url: "<%=request.getContextPath()%>/rs/Role/list",
            data: JSON.stringify({
                roleName: "admin",
                roleType:"admin"
            }),
            success: function( result ) {
                $("#msg").html( JSON.stringify(result));
            }
        });
    }
    function update() {
        $.post({
            url: "<%=request.getContextPath()%>/rs/Role/update",
            data: JSON.stringify({
                id:175,
                roleName: "master",
                roleType:"user"
            }),
            success: function( result ) {
                $("#msg").html( JSON.stringify(result));
            }
        });
    }
</script>